home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
xschem28.lzh
/
SRC
/
XSFTAB.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-16
|
13KB
|
486 lines
/* xsftab.c - built-in function table */
/* Copyright (c) 1988, by David Michael Betz
All Rights Reserved
Permission is granted for unrestricted non-commercial use */
#include "xscheme.h"
/* external variables */
extern LVAL s_stdin,s_stdout;
/* external functions */
extern void
xapply(),xcallcc(),xmap(),xmap1(),xforeach(),xforeach1(),
xforce(),xforce1(),xcallwi(),xcallwo(),xwithfile1(),
xload(),xloadnoisily(),xload1(),xsendsuper(),clnew();
extern LVAL
clisnew(),clanswer(),obisnew(),obclass(),obshow(),
xcons(),xcar(),xcdr(),
xcaar(),xcadr(),xcdar(),xcddr(),
xcaaar(),xcaadr(),xcadar(),xcaddr(),
xcdaar(),xcdadr(),xcddar(),xcdddr(),
xcaaaar(),xcaaadr(),xcaadar(),xcaaddr(),
xcadaar(),xcadadr(),xcaddar(),xcadddr(),
xcdaaar(),xcdaadr(),xcdadar(),xcdaddr(),
xcddaar(),xcddadr(),xcdddar(),xcddddr(),
xsetcar(),xsetcdr(),xlist(),xliststar(),
xappend(),xreverse(),xlastpair(),xlength(),xlistref(),xlisttail(),
xmember(),xmemv(),xmemq(),xassoc(),xassv(),xassq(),
xsymvalue(),xsetsymvalue(),xsymplist(),xsetsymplist(),xgensym(),
xboundp(),xget(),xput(),
xtheenvironment(),xprocenvironment(),xenvp(),xenvbindings(),xenvparent(),
xvector(),xmakevector(),xvlength(),xvref(),xvset(),
xvectlist(),xlistvect(),
xmakearray(),xaref(),xaset(),
xsymstr(),xstrsym(),
xnull(),xatom(),xlistp(),xnumberp(),xbooleanp(),
xpairp(),xsymbolp(),xintegerp(),xrealp(),xcharp(),xstringp(),xvectorp(),
xprocedurep(),xobjectp(),xdefaultobjectp(),
xinputportp(),xoutputportp(),xportp(),
xeq(),xeqv(),xequal(),
xzerop(),xpositivep(),xnegativep(),xoddp(),xevenp(),
xexactp(),xinexactp(),
xadd1(),xsub1(),xabs(),xgcd(),xrandom(),
xadd(),xsub(),xmul(),xdiv(),xquo(),xrem(),xmin(),xmax(),
xsin(),xcos(),xtan(),xasin(),xacos(),xatan(),
xxexp(),xsqrt(),xexpt(),xxlog(),xtruncate(),xfloor(),xceiling(),xround(),
xlogand(),xlogior(),xlogxor(),xlognot(),
xlss(),xleq(),xeql(),xgeq(),xgtr(),
xstrlen(),xstrnullp(),xstrappend(),xstrref(),xsubstring(),
xstrlist(),xliststring(),
xstrlss(),xstrleq(),xstreql(),xstrgeq(),xstrgtr(),
xstrilss(),xstrileq(),xstrieql(),xstrigeq(),xstrigtr(),
xcharint(),xintchar(),
xchrlss(),xchrleq(),xchreql(),xchrgeq(),xchrgtr(),
xchrilss(),xchrileq(),xchrieql(),xchrigeq(),xchrigtr(),
xread(),xrdchar(),xrdbyte(),xrdshort(),xrdlong(),xeofobjectp(),
xwrite(),xwrchar(),xwrbyte(),xwrshort(),xwrlong(),
xdisplay(),xnewline(),xprint(),xprbreadth(),xprdepth(),
xopeni(),xopeno(),xopena(),xopenu(),xclosei(),xcloseo(),xclose(),
xgetfposition(),xsetfposition(),xcurinput(),xcuroutput(),
xtranson(),xtransoff(),xgetarg(),xexit(),xcompile(),xdecompile(),xgc(),
xsave(),xrestore(),xtraceon(),xtraceoff(),xreset(),xerror(),
xicar(),xicdr(),xisetcar(),xisetcdr(),xivlength(),xivref(),xivset();
/* include machine specific declarations */
#include "osdefs.h"
int xsubrcnt = 12; /* number of XSUBR functions */
int csubrcnt = 17; /* number of CSUBR functions + xsubrcnt */
typedef LVAL (*FP)();
/* built-in functions */
FUNDEF funtab[] = {
/* functions that call eval or apply (# must match xsubrcnt) */
{ "APPLY", (FP)xapply },
{ "CALL-WITH-CURRENT-CONTINUATION", (FP)xcallcc },
{ "CALL/CC", (FP)xcallcc },
{ "MAP", (FP)xmap },
{ "FOR-EACH", (FP)xforeach },
{ "CALL-WITH-INPUT-FILE", (FP)xcallwi },
{ "CALL-WITH-OUTPUT-FILE", (FP)xcallwo },
{ "LOAD", (FP)xload },
{ "LOAD-NOISILY", (FP)xloadnoisily},
{ "SEND-SUPER", (FP)xsendsuper },
{ "%CLASS-NEW", (FP)clnew },
{ "FORCE", (FP)xforce },
/* continuations for xsubrs (# must match csubrcnt) */
{ "%MAP1", (FP)xmap1 },
{ "%FOR-EACH1", (FP)xforeach1 },
{ "%WITH-FILE1", (FP)xwithfile1 },
{ "%LOAD1", (FP)xload1 },
{ "%FORCE1", (FP)xforce1 },
/* methods */
{ "%CLASS-ISNEW", clisnew },
{ "%CLASS-ANSWER", clanswer },
{ "%OBJECT-ISNEW", obisnew },
{ "%OBJECT-CLASS", obclass },
{ "%OBJECT-SHOW", obshow },
/* list functions */
{ "CONS", xcons },
{ "CAR", xcar },
{ "CDR", xcdr },
{ "CAAR", xcaar },
{ "CADR", xcadr },
{ "CDAR", xcdar },
{ "CDDR", xcddr },
{ "CAAAR", xcaaar },
{ "CAADR", xcaadr },
{ "CADAR", xcadar },
{ "CADDR", xcaddr },
{ "CDAAR", xcdaar },
{ "CDADR", xcdadr },
{ "CDDAR", xcddar },
{ "CDDDR", xcdddr },
{ "CAAAAR", xcaaaar },
{ "CAAADR", xcaaadr },
{ "CAADAR", xcaadar },
{ "CAADDR", xcaaddr },
{ "CADAAR", xcadaar },
{ "CADADR", xcadadr },
{ "CADDAR", xcaddar },
{ "CADDDR", xcadddr },
{ "CDAAAR", xcdaaar },
{ "CDAADR", xcdaadr },
{ "CDADAR", xcdadar },
{ "CDADDR", xcdaddr },
{ "CDDAAR", xcddaar },
{ "CDDADR", xcddadr },
{ "CDDDAR", xcdddar },
{ "CDDDDR", xcddddr },
{ "LIST", xlist },
{ "LIST*", xliststar },
{ "APPEND", xappend },
{ "REVERSE", xreverse },
{ "LAST-PAIR", xlastpair },
{ "LENGTH", xlength },
{ "MEMBER", xmember },
{ "MEMV", xmemv },
{ "MEMQ", xmemq },
{ "ASSOC", xassoc },
{ "ASSV", xassv },
{ "ASSQ", xassq },
{ "LIST-REF", xlistref },
{ "LIST-TAIL", xlisttail },
/* destructive list functions */
{ "SET-CAR!", xsetcar },
{ "SET-CDR!", xsetcdr },
/* symbol functions */
{ "BOUND?", xboundp },
{ "SYMBOL-VALUE", xsymvalue },
{ "SET-SYMBOL-VALUE!", xsetsymvalue },
{ "SYMBOL-PLIST", xsymplist },
{ "SET-SYMBOL-PLIST!", xsetsymplist },
{ "GENSYM", xgensym },
{ "GET", xget },
{ "PUT", xput },
/* environment functions */
{ "THE-ENVIRONMENT", xtheenvironment },
{ "PROCEDURE-ENVIRONMENT", xprocenvironment},
{ "ENVIRONMENT?", xenvp },
{ "ENVIRONMENT-BINDINGS", xenvbindings },
{ "ENVIRONMENT-PARENT", xenvparent },
/* vector functions */
{ "VECTOR", xvector },
{ "MAKE-VECTOR", xmakevector },
{ "VECTOR-LENGTH", xvlength },
{ "VECTOR-REF", xvref },
{ "VECTOR-SET!", xvset },
/* array functions */
{ "MAKE-ARRAY", xmakearray },
{ "ARRAY-REF", xaref },
{ "ARRAY-SET!", xaset },
/* conversion functions */
{ "SYMBOL->STRING", xsymstr },
{ "STRING->SYMBOL", xstrsym },
{ "VECTOR->LIST", xvectlist },
{ "LIST->VECTOR", xlistvect },
{ "STRING->LIST", xstrlist },
{ "LIST->STRING", xliststring },
{ "CHAR->INTEGER", xcharint },
{ "INTEGER->CHAR", xintchar },
/* predicate functions */
{ "NULL?", xnull },
{ "ATOM?", xatom },
{ "LIST?", xlistp },
{ "NUMBER?", xnumberp },
{ "BOOLEAN?", xbooleanp },
{ "PAIR?", xpairp },
{ "SYMBOL?", xsymbolp },
{ "COMPLEX?", xrealp }, /*(1)*/
{ "REAL?", xrealp },
{ "RATIONAL?", xintegerp }, /*(1)*/
{ "INTEGER?", xintegerp },
{ "CHAR?", xcharp },
{ "STRING?", xstringp },
{ "VECTOR?", xvectorp },
{ "PROCEDURE?", xprocedurep },
{ "PORT?", xportp },
{ "INPUT-PORT?", xinputportp },
{ "OUTPUT-PORT?", xoutputportp },
{ "OBJECT?", xobjectp },
{ "EOF-OBJECT?", xeofobjectp },
{ "DEFAULT-OBJECT?", xdefaultobjectp },
{ "EQ?", xeq },
{ "EQV?", xeqv },
{ "EQUAL?", xequal },
/* arithmetic functions */
{ "ZERO?", xzerop },
{ "POSITIVE?", xpositivep },
{ "NEGATIVE?", xnegativep },
{ "ODD?", xoddp },
{ "EVEN?", xevenp },
{ "EXACT?", xexactp },
{ "INEXACT?", xinexactp },
{ "TRUNCATE", xtruncate },
{ "FLOOR", xfloor },
{ "CEILING", xceiling },
{ "ROUND", xround },
{ "1+", xadd1 },
{ "-1+", xsub1 },
{ "ABS", xabs },
{ "GCD", xgcd },
{ "RANDOM", xrandom },
{ "+", xadd },
{ "-", xsub },
{ "*", xmul },
{ "/", xdiv },
{ "QUOTIENT", xquo },
{ "REMAINDER", xrem },
{ "MIN", xmin },
{ "MAX", xmax },
{ "SIN", xsin },
{ "COS", xcos },
{ "TAN", xtan },
{ "ASIN", xasin },
{ "ACOS", xacos },
{ "ATAN", xatan },
{ "EXP", xxexp },
{ "SQRT", xsqrt },
{ "EXPT", xexpt },
{ "LOG", xxlog },
/* bitwise logical functions */
{ "LOGAND", xlogand },
{ "LOGIOR", xlogior },
{ "LOGXOR", xlogxor },
{ "LOGNOT", xlognot },
/* numeric com